Repository navigation
fix(annotations): stop two annotate runs from both superseding one statement - #74
Open
PiquelChips wants to merge 1 commit into
Open
PiquelChips wants to merge 1 commit into
PiquelChips wants to merge 1 commit into
Conversation
Two `origin annotate` runs by one user, on the same subject and kind, could both read the same current statement and both supersede it, leaving two current statements from one issuer. `Annotations::supersede` now reads the current statement and issues the new one in one step: under an exclusive lock of its own in the index directory, from the index read again, so it sees statements another process just issued. The lock is not the index's: issuing takes that one shared on another handle, which `flock` conflicts with within one process. `annotate`, and `--withdraw`'s lookup, call it instead of `current` followed by `issue`. Closes #39.
|
Warning Review limit reachedYou've used all free OSS reviews for now. Wait for the free limit to reset to keep reviewing this public repository. Next included review available in 49 minutes. View limit details
Thanks for using CodeRabbit! It's free for OSS, and your support helps us grow. If you like it, consider giving us a shout-out. |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Two
origin annotateruns by the same user, on the same revision and kind, could both read the same current statement and both supersede it. That left two current statements from one issuer, and the nextannotatesuperseded only the newer one.annotate(and--withdraw) now go throughAnnotations::supersede. It reads the current statement and issues the new one under a dedicated lock file,index/supersession, rereading the index inside the lock so it sees statements another process just issued. It can't use the index lock:commit_indexedtakes a shared index lock on a new file handle, andflockconflicts within one process. The lock is per store, so workspaces sharing a store share it. A statement issued in another store, such as a clone or a CI runner over the API, still supersedes what that issuer saw there, and the design doc now says so.Proved with
statements_issued_at_once_supersede_one_another: 50 rounds of two threads racing with different verdicts. Without the lock it failed 5 out of 5 runs, and without the reread inside the lock 3 out of 3.Reviewed with review-loop: 1 round with 2× GPT-6.1 Sol and Claude Opus 5.5. Verdict: approved
Closes #39
Note
Written by Claude Opus 5.5 in Claude Code and reviewed by GPT-6.1 Sol (via T3 Code)